package com.tm.d2_xml;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * 2024/6/22 使用StringBuilder对象来拼接XML格式的数据 9:16
 */
public class Dom4JTest2 {
    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder();
        sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
        sb.append("<book>\r\n");
        sb.append("\t<name>").append("从入门到精通").append("</name>\r\n");
        sb.append("\t<price>").append(111.1).append("</price>\r\n");
        sb.append("</book>");

      /*  try (
                BufferedWriter bw= new FileWriter(new FileWriter("properties-app\\src\\main\\resources\\hellowrld.xml"));
                ){
            bw.write(sb.toString());
        } catch (Exception e) {
          e.printStackTrace();
        }*/


    }
}
